package com.situ.mall.common.intercetpor;

import com.situ.mall.common.util.RequestUtil;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Logininterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object o = RequestUtil.getCurrent();
        if (o == null) {
            response.sendRedirect("/login");
        }
        return o != null;
    }
}
